#include "stdafx.h"
#include "CAnimal.h"
#include "CWolf.h"
#include <iostream>
#include <string>
using namespace std;

CAnimal::CAnimal()
{
}

CAnimal::~CAnimal()
{
}

CAnimal::CAnimal(int pg, int pa, int pb)
{
	m_gender = pg;
	m_age = pa;
	m_blood = pb;
}

void CAnimal::SetAnimal(int pg, int pa, int pb,int psteps)
{
	m_gender = pg;
	m_age = pa;
	m_blood = pb;
	m_steps = psteps;
}

void CAnimal::ShowAnimal()
{
	cout << "This is an animal" << endl;
	if (m_gender == 0)
		cout << "The animal is male. It is " << m_age << " years old."
		<< "Its blood level is " << m_blood << ". It moved " << m_steps << " steps." << endl;
	else
		cout << "The animal is female. It is " << m_age << " years old."
		<< "Its blood level is " << m_blood << ". It moved " << m_steps << " steps." << endl;

}

int CAnimal::BloodReduce()
{
		return 1;
}

int CAnimal::Move()
{
	return m_steps;
}

void CAnimal::Eat(CAnimal *anim)
{
	if (typeid(*anim) == typeid(CWolf))
		CWolf *wolf = dynamic_cast<CWolf *>(anim);
	else
		CSheep *sheep = dynamic_cast<CSheep *>(anim);
}

void CAnimal::Print(int flag,int i)
{
	if (flag == 0)
		cout << "Animal " << (i + 1) << " was dead!" << endl;
	else
		cout << "Animal " << (i + 1) << " is alive!" << endl;
}
